﻿namespace Homework3
{
    class Rectangle : IShape
    {
        readonly double area;
        readonly bool isValid;
        public Rectangle(double width, double length)
        {
            if (width < 0 || length < 0)
            {
                isValid = false;
                return;
            }
            isValid = true;
            area = width * length;
        }
        public double GetArea()
        {
            if (!isValid) return 0;
            return area;
        }

        public bool IsValid()
        {
            return isValid;
        }
    }
}
